<?php
    header('content-type:text/html;charset=utf-8');
    $mysql_conf=array(
        'host'=>'localhost:3306',
        'db_user'=>'root',
        'db_pwd'=>'',
        'db'=>'newdate'
    );
    $mysqli=@new mysqli($mysql_conf['host'],$mysql_conf['db_user'],$mysql_conf['db_pwd']);
    if($mysqli->connect_errno){
        die('连接失败'.$myspli->connect_errno);
    };//判断连接是否成功
    // echo 'ok';
    $mysqli->query('set names utf8');//设置查询字符
    $select_db=$mysqli->select_db($mysql_conf['db']);//选择数据库
    if(!$select_db){
        die('数据库连接错误'.$mysqli->error);
    }
    // $sql="select * from user";//sql语句
    // $resu=$mysqli->query($sql);
    // $arr=array();
    // while($row=$resu->fetch_assoc()){//查询到的语句逐条输出
    //     array_push($arr,$row);
    // }
    // $json=json_encode($arr);
    // echo $json;
    // $mysqli->close();//关闭连接

?>